<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>

<script type="text/javascript">
	$(document).ready(function() {

	});
	function board_modifyform_check(frm){
		if($("#bd_pwd").val()==''){
			alert("비밀번호를 입력해주세요");
			$("#bd_pwd").focus();
			return false;
		}
		return true;
	}
	
	function addFile(){
		if($(".spanFile").length>19){
			alert("파일업로드는 20개까지만 가능합니다");
			return false;
		}

		var html = 
			"<span class=\"spanFile\">"+
			"<input style=\"width: 235px\" class=\"css_input\" title=\"파일\" name=\"file\" type=\"file\"> "+
			"<img style=\"cursor: hand\" class=\"btnfiledel\" onclick=\"deleteFile(this);\" border=\"0\" alt=\"파일삭제\" src=\"/usr/images/btn_file_minus.gif\" > "+
			"<br/>"+
			"</span>";
			
		if($(".spanFile").length==0){
			$("#fileDiv").html(html);
		}else{
			$(".spanFile:last").after(html);
		}

	}

	function deleteFile(me){
		$(me).parent().remove();
	}
</script>

<table width="100%" border="0" cellspacing="0" cellpadding="0"
	align="center">
	<tr>
		<td valign="top" align="center">
			<TABLE width="100%" cellpadding="0" cellspacing="0">
				<TR>
					<TD><BR>
						<form action="./ubdmg0105T.do" name="modi_form"
							method="post" ENCTYPE="multipart/form-data"
							onsubmit="return board_modifyform_check(this);">
							<input type="hidden" name="p_id" value="${brd.p_id }">
							<input type="hidden" name="brd_no" value="${brd.brd_no }">
							<input type="hidden" name="bd_no" value="${brd.bd_no }">

							<table cellspacing="0" cellpadding="0" border="0" width="100%">
								<tr>
									<td colspan="2" height="1" class="css_line"></td>
								</tr>
								<tr>
									<td width="100" class="sub1">&nbsp; 이름</td>
									<td class="sub3"><input type="text" name="bd_name"
										value="${brd.bd_name }" class="css_input" style="width: 125px"></td>
								</tr>
								<tr <c:if test="${!empty sessionScope['userInfo'].admin_id || param.p_id == sessionScope['userInfo'].p_id }">style="display: none;"</c:if>>
									<td width="100" class="sub1">&nbsp; 비밀번호</td>
									<td class="sub3"><input type="password" name="bd_pwd" id="bd_pwd" value="<c:if test="${!empty sessionScope['userInfo'].admin_id || param.p_id == sessionScope['userInfo'].p_id }">${brd.bd_pwd }</c:if>"
										class="css_input" style="width: 125px"></td>
								</tr>
								<tr>
									<td width="100" class="sub1">&nbsp; 이메일</td>
									<td class="sub3"><input type="text" name="bd_email"
										value="${brd.bd_email }" class="css_input" style="width: 50%"></td>
								</tr>
								<tr>
									<td width="100" class="sub1">&nbsp; 제목</td>
									<td class="sub3"><input type="text" NAME="bd_title" value="${brd.bd_title }"
										class="css_input" style="width: 95%"></td>
								</tr>
<c:if test="${!empty sessionScope['userInfo'].admin_id || param.p_id == sessionScope['userInfo'].p_id }">
								<tr>
									<td width="100" class="sub1">&nbsp; 등록일</td>
									<td class="sub3"><input type="text" NAME="reg_dt" value="${brd.reg_dt }" maxlength="14"
										class="css_input" style="width: 95%"></td>
								</tr>
</c:if>
								<tr>
									<td colspan="2" height="1" class="css_line"></td>
								</tr>
								<tr valign="top">
									<td width="100" class="sub1">&nbsp; 내용</td>
									<td class="sub3"><TEXTAREA NAME="bd_content" cols="65" rows="35"
											style="width: 95%; height: 200px;" class="css_input">${brd.bd_content }</TEXTAREA>
									</td>
								</tr>
<!-- 								<tr> -->
<!-- 									<td width="100" class="sub1">&nbsp; 파일첨부</td> -->
<!-- 									<td class="sub3"> -->
<!-- 										<div id="fileDiv"></div> -->
<!-- 									</td> -->
										
<!-- 								</tr> -->
								<tr>
									<td colspan="2" height="1" class="css_line"></td>
								</tr>
								<tr>
									<td width="100" class="sub1" style="vertical-align: top;">&nbsp; 파일 <a href="#" onclick="addFile();"><img src="/usr/images/btn_file_add.gif" style="vertical-align: middle; cursor: hand"/> </a></td>
									<td class="sub3">
	<c:if test="${fileList !=null && fn:length(fileList)>0 }">
		<c:forEach var="map1" items="${fileList}" varStatus="status">
			<c:if test="${status.index!=0 }">,</c:if>
			<a href="${map1.p_file_nm }" target="_blank">${map1.view_file_nm }</a> <label><input name="del_bdf_no" value="${map1.bdf_no }" type="checkbox" />삭제 </label>
			
		</c:forEach>
	</c:if>
										<div id="fileDiv">

										</div>
									</td>
								</tr>
								<tr>
									<td colspan="2" height="1" class="css_line"></td>
								</tr>
								<tr>
									<td width="100" class="sub1">&nbsp; 잠금글</td>
									<td class="sub3"><INPUT TYPE="checkbox" NAME="secret_yn"
										value="Y" <c:if test="${'Y'==brd.secret_yn }">checked="checked"</c:if>> 비공개 ( 비밀번호 일치해야 글보기 가능 )</td>
								</tr>
								<tr>
									<td width="100" class="sub1" align="center">&nbsp; 공지여부</td>
									<td class="sub3"><label><INPUT TYPE="checkbox" name="notice_yn"
										value="Y" <c:if test="${'Y'==brd.notice_yn }">checked="checked"</c:if>> 상위에 항상 보임</label></td>
								</tr>
								<tr>
									<td colspan="2" height="1" class="css_line"></td>
								</tr>
							</table>
							<!-- btn-->
							<div style="text-align: center; padding: 20px 5px 5px 0px">
								<input type="image" src="/usr/images/btn_conf.gif"
									border="0"></a> <a
									href="./ubdmg0107Q.do?p_id=${brd.p_id }&brd_no=${brd.brd_no }&bd_no=${brd.bd_no }"><img
									src="/usr/images/btn_cancel.gif" border="0"></a>
							</div>
						</form></TD>
				</TR>
			</TABLE>
		</td>
	</tr>
</table>

